﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Core.Model;
using Core.Model.Questions;

namespace SocialVoting.Controllers
{
    public class QuestionsController : Controller
    {
        //
        // GET: /QuestionsEditor/

        [HttpGet]
        public ActionResult QuestionsEditor()
        {

            var list = new Core.Model.QuestionList("testTitle", "testDescription", false);
            ViewBag.QuestionList = list;
            return View(list);
        }

        [HttpGet]
        public  ActionResult Question()
        {
            return View();
        }

        [HttpGet]
        public ActionResult DateQuestion()
        {
            return View();
        }


        public ActionResult CheckBoxQuestion(string val)
        {
            var a = Request["tb"];
            var question = new QuestionWithManyAnswers();
            for (int i = 0; i < 18 -1; i++ )
                question.AnswerVariants.Add(new Answer());
            return View(question);
        }


        [HttpPost]
        public ActionResult QuestionsEditor(Core.Model.QuestionList questionList)
        {
            //saveQuestionary
           // var v = (TextQuestion)ViewBag.TextQuestion; 

            ViewBag.QuestionList = questionList;
            return View(questionList);
        }

       
        public ActionResult TextQuestion()
        {
            return View("TextQuestion");
        }

       // public ActionResult SaveChanges(Core.Model.QuestionList questionList)
    //    {
     //       return RedirectToAction("QuestionsEditor");
      //  }


       // [HttpGet]
     /*   public ActionResult PartialPick(int id)
        {
            if (id.Equals(1))
            {
                return Partial1(new TextQuestion(){QuestionText = ""});
            }
            else
            {
                return View("Error");
            }
        }


        public ActionResult Partial1(Core.Model.Questions.TextQuestion textQuestion)
        {
            var x = ViewBag.QuestionList;
            ViewBag.TextQuestion = textQuestion;
            return PartialView("Partial1",textQuestion);

        }

        public ActionResult AddQuestion()
        {
            return View("QuestionsEditor");
        }
      */ 

    }
}
